package maxStream;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;

public class Demo {
    public static void main(String[] args) {
        //自定义排序
        List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6);
        //从大到小排序
        Optional<Integer> max = list.stream().max((o1, o2) -> o2 - o1);
        System.out.println("最大值为+"+ max.get());

    }
}
